
class P443_39643 {

	static long[] humbleNumbers = new long[6000];
	static int index = 0;
	
    public static void main(String[] args) {
    	calculateHumbleNumbers();
    	QuickSort(humbleNumbers, 0, index);
    	String line = readLn();
    	
    	while (!"0".equals(line)) {
    		if (line.endsWith("11") || line.endsWith("12") || line.endsWith("13")) System.out.print("The " + line + "th humble number is ");
    		else if (line.endsWith("1")) System.out.print("The " + line + "st humble number is ");
    		else if (line.endsWith("2")) System.out.print("The " + line + "nd humble number is ");
    		else if (line.endsWith("3")) System.out.print("The " + line + "rd humble number is ");
    		else System.out.print("The " + line + "th humble number is ");
    		System.out.println(humbleNumbers[Integer.parseInt(line)] + ".");
    		line = readLn();
    	}
    }

	private static void calculateHumbleNumbers() {
		for (long i = 0; (long)Math.pow(2, i) <= (long)2000000000 ; i++) {
			for (long j = 0; (long)Math.pow(3, j) <= (long)2000000000; j++) {
				for (long k = 0; (long)Math.pow(5, k) <= (long)2000000000; k++) {
					for (long l = 0; (long)Math.pow(7, l) <= (long)2000000000; l++) {
						long lo = (long) (Math.pow(2, i) * Math.pow(3, j) * Math.pow(5, k) * Math.pow(7, l));
						if (lo <= 2000000000 && lo > 0) {
							humbleNumbers[index++] = lo;
						}
					}
				}
			}
		}
		
	}

	
	static void QuickSort(long a[], int lo0, int hi0) {
        int lo = lo0;
        int hi = hi0;
        long mid;
 
        if (hi0 > lo0) {
 
            mid = a[(lo0 + hi0) / 2];
 
            while (lo <= hi) {
                while ((lo < hi0) && (a[lo] < mid))
                    ++lo;
 
                while ((hi > lo0) && (a[hi] > mid))
                    --hi;
 
                if (lo <= hi) {
                    swap(a, lo, hi);
 
                    ++lo;
                    --hi;
                }
            }
 
            if (lo0 < hi)
                QuickSort(a, lo0, hi);
 
            if (lo < hi0)
                QuickSort(a, lo, hi0);
 
        }
}
	
	private static void swap(long[] a, int lo, int hi) {
		long aux = a[lo];
		a[lo] = a[hi];
		a[hi] = aux;
		
	}

	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return (buffer.toString()).trim();
    }

}